'use strict';

describe('Directive: scrollingTo', function () {

    // load the directive's module
    beforeEach(module('homepageApp'));

    var element,
        scope;

    beforeEach(inject(function ($rootScope, $compile) {
        //scope = $rootScope.$new();
        element = angular.element(
            '<div>'+
                "<a scrolling-to='someid'>View details</a>"+
                '<p class="btn btn-default" scrolling-to="" role="button">View details</p>'+
                '<h1 class="btn btn-default" scrolling-to="somename" role="button">View details</h1>'+
                '<h2 class="btn btn-default" scrolling-to="idontexist" role="button">View details</h2>'+
                '<div id="Difference between relational database and dynamodb">aaaaaaaaaaa</div>'+
                '<div id="someid">bbbbbbbbbbb</div>'+
                '<div name="somename">ccccccccccccc</div>'+
            '</div>'
        );
        scope = $rootScope;
        $compile(element)(scope);
        scope.$digest();
    }));

    it('scroll to specific element in page with', inject(function ($compile) {
        console.log(element.find('a').triggerHandler('click'));
    }));

    it('scroll to element in page that doesnt exist', inject(function ($compile) {
        console.log(element.find('h2').triggerHandler('click'));
    }));

    it('scroll to a name in page', inject(function ($compile) {
        console.log(element.find('h1').triggerHandler('click'));
    }));

    it('scroll to blank aka top element in page', inject(function ($compile) {
        console.log(element.find('p').triggerHandler('click'));
    }));
});